#define _CRT_SECURE_NO_WARNINGS 1
#pragma warning(disable:6031)

//https://www.nowcoder.com/practice/179d9754eeaf48a1b9a49dc1d438525a?tpId=290&tqId=39941&ru=/exam/oj
#include <iostream>
using namespace std;

int main() {
    int L, R;
    int count = 0;
    while (cin >> L >> R)
    {
        for (int i = L; i <= R; i++)
        {
            int j = i;
            while (j)
            {
                int ret = j % 10;
                j /= 10;
                if (ret == 2)
                    count++;
            }
        }
    }
    cout << count;
}
